/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 campaign_file.h

	$Header: /heroes4/campaign_file.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( CAMPAIGN_FILE_H_INCLUDED )
#define CAMPAIGN_FILE_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "resource_traits.h"

#include <iostream>

#include "memory_buffer.h"


class t_campaign_file 
{
public:
	
	// Constructors / Destructor
	t_campaign_file();
	virtual ~t_campaign_file();
		
	t_memory_buffer_counted_ptr			get_data_buffer();

	void load_campaign_file( std::string & campaign_file );
	void load_campaign_file( std::streambuf& buffer );

	bool						read(  std::streambuf& buffer );
	void						save_campaign_file( std::streambuf& buffer ) const;
	bool						write( std::streambuf& buffer ) const;

protected:

	t_memory_buffer_counted_ptr			m_file_data;

};

inline bool read( std::streambuf& buffer, t_campaign_file& campaign_file )
{
	return campaign_file.read( buffer );
}

/////////////////////////////////////////////////////////////////////////////

template <>
struct t_resource_traits<t_campaign_file>
{
	static char const prefix[];
	static char const extension[];
};

/////////////////////////////////////////////////////////////////////////////
#endif // !defined( CAMPAIGN_FILE_H_INCLUDED )
